package org.example;

import org.example.pojo3.Animal;
import org.example.pojo3.AppConfig;
import org.junit.Before;

import org.junit.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;


public class Springtest3 {
    private AnnotationConfigApplicationContext context;
    @Before
    public void setUp() throws Exception {
        context = new AnnotationConfigApplicationContext(AppConfig.class);
    }
    @Test
    public void test() {
        Animal animal = (Animal) context.getBean("animal");
        System.out.println(animal);
        Animal animal2 = (Animal) context.getBean("animal");
        System.out.println(animal2);
        System.out.println(animal==animal2);

        //
        Animal animal3 = (Animal) context.getBean("getAnimal");
        System.out.println(animal3);
    }
}
